<?php

namespace app\model;
use app\model\UserOrder as ModelUserOrder;
use app\model\DriverInfo as ModelDriverInfo;
use app\model\StationInfo as ModelStationInfo;

use think\Db;

class UserOrderPayLog extends Common
{
    protected static $obj;

    public function _initialize()
    {
        parent::_initialize();
        $this->db_name = 'user_order_pay_log';
    }

    /**
     * 类入口
     * @return UserOrderPayLog
     */
    public static function getInstance()
    {
        if (is_null(self::$obj))
            self::$obj = new self();
        return self::$obj;
    }

    /*
     * 生成用户付款记录
     */
    public function userPayLogAdd($orderNumber,$payType,$remark='')
    {
        $data['order_id'] = ModelUserOrder::getInstance()->toValue(['order_sn'=>$orderNumber],'order_id');
        $data['order_number'] = $orderNumber;
        $data['describe'] = '用户订单支付';
        $data['user_id'] = ModelUserOrder::getInstance()->toValue(['order_sn'=>$orderNumber],'user_id');
        $data['pay_type'] = $payType;
        $data['remark'] = $remark;
        $data['money'] = ModelUserOrder::getInstance()->toValue(['order_sn'=>$orderNumber],'order_amount');
        $this->toAdd($data);
    }

}
